from django.db import models
from django import forms
from django.forms.fields import DateField, ChoiceField, MultipleChoiceField
from django.forms.widgets import CheckboxSelectMultiple
from myEvents.models import * 
import datetime

class IndexForm(forms.Form):
	user_email = forms.EmailField()
	event_name = forms.CharField(max_length=1024,initial="Replace with your event name")
	
class RegisterForm(forms.Form):
	user_email = forms.EmailField()
	
class AdminForm(forms.Form):
	eventDate = forms.DateField()
	voteDate = forms.DateField()
	emails = forms.CharField(max_length=1024)
	places = forms.ModelMultipleChoiceField(required=False, queryset=Place.objects.all(), widget=CheckboxSelectMultiple())
#	class Meta:
#		model = Place	
#	def __init__(self, *args, **kwargs):
#		super(AdminForm, self).__init__(*args, **kwargs)
#		self.fields['places'].choices = [x for x in Place.objects.all()] 

class VoteForm(forms.Form):
	def __init__(self, qs=None, *args, **kwargs):
		super(VoteForm, self).__init__(*args, **kwargs)
		self.fields['places'].queryset = qs

	places = forms.ModelMultipleChoiceField(required=False, queryset=Place.objects.all(),  widget=CheckboxSelectMultiple())
	#places = forms.ModelMultipleChoiceField(required=False,  widget=CheckboxSelectMultiple())

	
